<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>

  <body>
    <div id="app">
      <cpn1></cpn1>
      <cpn2></cpn2>
    </div>

    <script src="../js/vue.js"></script>
    <script>
      // 1.全局组件注册的语法糖
      // 省去了写Vue.extend的步骤，第二个参数放一个对象(自动调用 Vue.extend)
      Vue.component('cpn1', {
        template: `
				<div>
          <h2>我是组件cpn1</h2>  
					<p>111</p>
        </div>`
      })

      // 2.局部组件注册的语法糖
      const app = new Vue({
        el: '#app',
        data: {
          message: '你好'
        },
        components: {
          cpn2: {
            template: `
						<div>
        		  <h2>我是组件cpn2</h2>  
							<p>222</p>
        		</div>`
          }
        }
      })
    </script>
  </body>
</html>
